/**
 * 双线
 * ibio-develop
 * 2008-11-22 17:42
 */
package com.ibio8.components.wave.behavior {
	import com.ibio8.components.wave.WaveBody;
	
	import flash.utils.ByteArray;
	
	public class  DoubleLine implements IWaveBehavior {
		
		protected var m_spaceY:Number = 40;
		
		public function show(ba:ByteArray, sp:WaveBody):void {
			var dispY1:Number = sp.h / 2 - m_spaceY;
			var dispY2:Number = dispY1 + m_spaceY * 2;
			sp.graphics.moveTo(0, dispY1);
			for (var i:uint = 0; i < 256; i++) {
				var num:Number = -ba.readFloat()*(sp.w / 2) + dispY1;
				sp.graphics.lineTo(i * sp.w / 256, num);
			}
			sp.graphics.moveTo( 0, dispY2 );
			for ( i = 0; i < 256; i++) {	
				num = -ba.readFloat()*(sp.w / 2) + dispY2;
				sp.graphics.lineTo(i * sp.w / 256, num);
			}
		}
	}
}